package com.sixdog.regulate.service.impl;

import com.sixdog.regulate.bean.CmdResult;
import com.sixdog.regulate.cmdService.CmdUtils;
import com.sixdog.regulate.service.KeycodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class keycodeServiceImpl implements KeycodeService {

    @Autowired
    private CmdUtils cmdUtils;
    //按一次
    @Override
    public CmdResult pressKey(String deviceSerial, int keyCode) {
        StringBuilder command = new StringBuilder().append("adb -s ").append(deviceSerial).append(" exec-out input keyevent ").append(keyCode);
        CmdResult cmdResult = cmdUtils.execute(command);
        return cmdResult;
    }

}
